#include "DXUT.h"
#include "MeshRender.h"


CMeshRender::CMeshRender(void)
{
	m_pVB = NULL;
	m_pIB = NULL;
	m_pVertexLayout = NULL;
	m_iVType = VERTEXTYPE::VT_POSNORMUV;
	STRIDE_SIZE = 0;
	m_bModelReady = false;
	D3DXMatrixIdentity(&m_mWorldModel);
	m_vCenter = D3DXVECTOR3(0,0,0);
	m_fRadius = 0.0f;
	m_b32bitIndex = true;
	m_bSupportLocalCoords = false;
	m_bConstructLocalCoords = false;
}


CMeshRender::~CMeshRender(void)
{
	OnD3D11DestroyDevice(NULL);
}

HRESULT CMeshRender::OnD3D11CreateDevice( ID3D11Device* pd3dDevice, ID3DX11EffectTechnique* pTech, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, CDirectoryUtil* pDirUtil, void* pUserContext )
{
  return S_OK;
}

HRESULT CMeshRender::OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, CDirectoryUtil* pDirUtil, void* pUserContext )
{
 return S_OK;
}

void CMeshRender::OnD3D11ReleasingSwapChain( void* pUserContext )
{
}

void CMeshRender::OnD3D11DestroyDevice(void* pUserContext)
{
	SAFE_RELEASE(m_pVB);
	SAFE_RELEASE(m_pIB);
	SAFE_RELEASE(m_pVertexLayout);
	m_bModelReady = false;
}

bool CMeshRender::LoadModel(const char* pFileName,ID3D11Device* pd3dDevice)
{
	return true;
}

void CMeshRender::Render( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, 
	ID3DX11Effect* pEffect, ID3DX11EffectTechnique* pRenderTech, enum RENDERMESHTECH iMeshType, const D3DXMATRIX& mWorldCamera, double fTime, float fElapsedTime, void* pUserContext )
{
}